<template>
  <div class="container">
    <div class="tabsNew">
      <el-tabs v-model="activeName" @tab-click="handleClick" class="weightTabs">
        <el-tab-pane
          label="驾校审核"
          name="jxsh"
          :lazy="true"
          v-if="checkPermission(['schoolApproval'])"
        >
          <driving v-if="activeName == 'jxsh'"></driving>
        </el-tab-pane>
        <el-tab-pane
          label="机构审核"
          name="jgsh"
          :lazy="true"
          v-if="checkPermission(['schoolTeamApproval'])"
        >
          <institutions v-if="activeName == 'jgsh'"></institutions>
        </el-tab-pane>
        <el-tab-pane
          label="平台审核"
          name="ptsh"
          :lazy="true"
          v-if="checkPermission(['platformApproval'])"
        >
          <platformAudit v-if="activeName == 'ptsh'"></platformAudit>
        </el-tab-pane>
        <el-tab-pane
          label="活动审核"
          name="hdsh"
          :lazy="true"
          v-if="checkPermission(['activityApproval'])"
        >
          <activityAudit v-if="activeName == 'hdsh'"></activityAudit>
        </el-tab-pane>
        <el-tab-pane
          label="训练场审核"
          name="xlcsh"
          :lazy="true"
          v-if="checkPermission(['trainApproval'])"
        >
          <trainingAudit v-if="activeName == 'xlcsh'"></trainingAudit>
        </el-tab-pane>
        <el-tab-pane
          label="考场审核"
          name="kcsh"
          :lazy="true"
          v-if="checkPermission(['examSchoolApproval'])"
        >
          <examPlaceAudit v-if="activeName == 'kcsh'"></examPlaceAudit>
        </el-tab-pane>
        <el-tab-pane
          label="教练审核"
          name="jlsh"
          :lazy="true"
          v-if="checkPermission(['coachApproval'])"
        >
          <coachAudit v-if="activeName == 'jlsh'"></coachAudit>
        </el-tab-pane>
        <el-tab-pane
          label="班型审核"
          name="bxsh"
          :lazy="true"
          v-if="checkPermission(['packageApproval'])"
        >
          <classTypeAudit v-if="activeName == 'bxsh'"></classTypeAudit>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script type="text/javascript">
import driving from "./driving";
import institutions from "./institutions";
import platformAudit from "./platformAudit";
import activityAudit from "./activityAudit";
import trainingAudit from "./trainingAudit";
import examPlaceAudit from "./examPlaceAudit";
import coachAudit from "./coachAudit";
import classTypeAudit from "./classTypeAudit";
import checkPermission from "@/utils/permission"; // 权限判断函数
export default {
  data() {
    return {
      activeName: "jxsh",
    };
  },
  components: {
    driving,
    institutions,
    platformAudit,
    activityAudit,
    trainingAudit,
    examPlaceAudit,
    coachAudit,
    classTypeAudit,
  },
  methods: {
    checkPermission,
    handleClick(tab, event) {
      this.activeName = tab.name;
    },
  },
};
</script>

<style lang="scss" scoped>
::v-deep {
  .is-active {
    font-weight: bold;
  }
  .weightTabs .el-tabs__item {
    font-size: 16px;
  }
  .el-tabs__header {
    margin: 0;
  }
}
</style>
